#include <stdio.h>
#include "c_array.h"

struct node_data{
    int _data;
};

int main()
{
    Array* array = ConstructArray(10);

    printf("array size:%u,capacity:%u\n",Length(array),Capacity(array));

    for(int i=0; i<100; ++i)
    {
        node_data* pData = (node_data*)malloc(sizeof(node_data));
        pData->_data = i;
        PushBack(array,(void*)pData);
    }

    for(int i=0; i<100; ++i)
    {
        node_data* pData = (node_data*)malloc(sizeof(node_data));
        pData->_data = i;
        PushFront(array,(void*)pData);
    }

    for(int i=0;i<Length(array);++i)
    {
        node_data* pData = ((node_data*)(At(array,i)));
        printf("%u\n",pData->_data);
        free((void*)pData);
        pData = NULL;
    }

    Clear(array);

    printf("array size:%u,capacity:%u\n",Length(array),Capacity(array));

    DestructArray(array);
    return 0;
}